﻿using System;
using System.Windows.Forms;
using Tools;

namespace Teacher.登录
{
    public partial class 导师端登录 : Form
    {
        public 导师端登录()
        {
            InitializeComponent();
        }

        Models.Teacher m_user = new Models.Teacher();
        BLL.B_Teacher b_user = new BLL.B_Teacher();

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Models.Teacher teacher = new Models.Teacher();
                teacher.teacher_uname = textBox1.Text;

                //md5加密信息框，但感觉不起作用，应该在登录时加密登录密码
                teacher.pwd = MD5Provider.Hash(textBox2.Text);
                
                BLL.B_Teacher b_Teacher = new BLL.B_Teacher();
                bool res = b_Teacher.Login(teacher);
                if (res)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    throw new Exception("用户名或密码错误");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

        private void 导师端登录_Load(object sender, EventArgs e)
        {

        }
    }
}
